#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TablePlayerDealConfigDao:DaoBase<TablePlayerDealConfig>
    {
        public override string GetFileName()
        {
            return "TablePlayerDealConfig.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TablePlayerDealConfig>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TablePlayerDealConfig model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.itemId)) UnityEngine.Debug.LogError("数据表id重复:TablePlayerDealConfig->id: " + model.itemId);
            #endif
            cachePrimaryInt[model.itemId] = model;
        }
        protected override TablePlayerDealConfig ParseRowData(string[] rowData)
        {
            TablePlayerDealConfig data = new TablePlayerDealConfig();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.itemId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.itemLogicType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.itemType = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.itemSubType = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.defaultPrice = ParseStringIntern(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.maxPrice = ParseStringIntern(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.checkPrice = ParseStringIntern(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.isbargain = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.bargainPriceRate = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.protectDays = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.suspiciousRate = string.Intern(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.maxRise = int.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.maxFall = int.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.changeExtent = int.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.dealCompleteTip = string.Intern(rowData[14]);
            }
            return data;
        }
    }
}
